package com.sugar.real.estate.module.business.controller.app.info.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;

import static com.sugar.real.estate.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "APP - 资讯信息 Response VO")
@Data
public class AppInfoRespVO {

    @Schema(description = "资讯分类ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9307")
    private Long id;

    @Schema(description = "封面图", requiredMode = Schema.RequiredMode.REQUIRED)
    private String banner;

    @Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED)
    private String title;
    private String titleZhCn;
    private String titleEnUs;

    @Schema(description = "内容", requiredMode = Schema.RequiredMode.REQUIRED)
    private String content;
    private String contentZhCn;
    private String contentEnUs;

    @Schema(description = "发布时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonSerialize(using = LocalDateSerializer.class) // 序列化（响应）
    @JsonDeserialize(using = LocalDateDeserializer.class) // 反序列化（请求）
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate releaseDate;

    @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "8056")
    private Long viewCount;

    @Schema(description = "作者名")
    private String author;
    private String authorZhCn;
    private String authorEnUs;
}